1. Field of the Invention
This invention relates to systems and methods which provide a processor with fast memory access and particularly to cache and scratch pad memory systems.
2. Description of Related Art
Processors often employ memories which are relatively slow when compared to the clock speeds of the processors. To speed up memory access for such processors, a relatively small amount of fast memory can be used in a data cache or scratch pad. A scratch pad typically occupies a portion of the address space of a processor, and programs executed by the processor access the scratch pad to take advantage of the faster memory access. A scratch pad has the disadvantage of only improving memory access time for the relatively small portion of the address space that corresponds to the scratch pad.
A cache can mediate memory accesses and improve the average memory access time for all or a large portion of the address space of a processor even though the cache is small relative to the address space. Caches do not occupy a specific portion of the address space of the processor but instead include tag information which identifies addresses for information in cache lines. Typically, a cache compares an address from a processor to tag information to determine whether the cache contains a valid entry for the memory address being accessed. If such an entry exists (i.e., if there is a cache hit), the processor accesses (reads from or writes to) the faster cache memory. In addition to tag information, a cache entry typically contains a "validity" bit and a "dirty" bit which respectively indicated whether the associated information in the entry is valid and whether the associated information contains changes to be written back to the slower memory. If there is no cache entry for the address being accessed (i.e., if there is a cache miss), access to the slower memory may be required for the cache to create a new entry for the just accessed memory address. Caches use schemes such as "least recently used" replacement to determine which old entries are replaced with new entries. Typically, programs access the same addresses repeatedly so that the most recently accessed data is likely to be accessed again soon and be available in the cache when required. Accordingly, caches can improve access time across the address space of the processor, but the overhead for hit/miss calculations, entry creation, and writebacks can make caches slower than scratch pads.